import utils from "@/utils";
import { http } from "../plugins/axios"
import { CacheEnum } from "@/enum/userEnum";

interface LinkItem {
    bid: string
    title: string,
    author: string,
    avatar: string,
    comments:string,
    goods:string,
    views:string,
    time:string,
  }



 function search(text: string){
      return http.request<LinkItem[]>({
        url:`es/search`,
        method:"get",
        params:{text:text},
        headers:{token:utils.store.get(CacheEnum.TOKEN_NAME)}
      })
}

function searchForText(text: string){
  return http.request<LinkItem[]>({
    url:`es/searchText`,
    method:"get",
    params:{text:text},
    headers:{token:utils.store.get(CacheEnum.TOKEN_NAME)}
  })
}




export default {search,searchForText}